$NG.AllReady(function (page, { useValuesChange, useUpdateRow, useUpdateRows, useBeforeClick }) {
    console.log($NG.getPageUI());
    console.log($NG.getPageState());
    // 获取控件
    const form = $NG.getCmpApi("p_form_equipment_list_split");
    const grid = $NG.getCmpApi("p_form_equipment_split_d");
    const grid2 = $NG.getCmpApi("p_form_equipment_split_dd");
  
    const dataMaps_key = {};
  
    ////////////////////////////////////////////////////////////////////////////////////////////////////btn
  
    // 隐藏 grid1 按钮
    const gridToolbar = $NG.getCmpApi("toolbar_p_form_equipment_split_d");
    gridToolbar.getItem("imp").setProps({ children: "引用设备清单明细" });
    ["attachment", "addrow"].forEach((btn) => gridToolbar.hideButton(btn));
  
    // 隐藏 grid2 按钮
    const grid2Toolbar = $NG.getCmpApi("toolbar_p_form_equipment_split_dd");
    ["imp", "addrow", "deleterow", "attachment"].forEach((btn) => grid2Toolbar.hideButton(btn));
  
    // save按钮点击前
    useBeforeClick(async ({ args }) => {
      let lock = true;
      const _data = grid.getData();
      const dataMap = {};
      const errArr = [];
      _data.forEach((item) => {
        // console.log(item);
        dataMap[item.u_eq_phid] ? (dataMap[item.u_eq_phid] += Number(item.u_qty) || 0) : (dataMap[item.u_eq_phid] = Number(item.u_qty) || 0);
      });
      for (let key in dataMap) {
        window._lsz_catch_cntDetial.forEach((elem) => {
          if (key == elem.u_eq_phid && dataMap[key] > elem.qty) {
            lock = false;
            errArr.push(key);
          }
        });
      }
      // console.log(lock, dataMap);
      if (!lock) {
        $NG.alert(`部分设备清单明细数量超出设备清单数量<<<< ${errArr} >>>>`);
      }
      return lock;
    }, "save");
  
    ////////////////////////////////////////////////////////////////////////////////////////////////////form
  
    if (form) {
      mstformUpdateUI();
      if (page.oType == "add" || page.oType == "edit" || page.oType == "copy") {
        getSupplyFromCnt();
        getEqInfoByPhid_pc();
        getPcInfo();
        getCntCount();
        getCntDetialByPhid();
        setTimeout(() => {
          mstformcaculate();
        }, 100);
      }
  
      // 项目字段变化
      useValuesChange(({ args }) => {
        getEqInfoByPhid_pc();
        getPcInfo();
        getSupplyFromCnt();
        getCntDetialByPhid();
        getCntCount();
        setTimeout(() => {
          mstformcaculate();
        }, 100);
      }, "p_form_equipment_list_split.phid_pc");
  
      // 监听表头 `u_split_rate` 变化
      useValuesChange(({ args }) => {
        const u_split_rate = form.getItem("u_split_rate").getValue();
        const data = grid.getData().map((item) => ({ ...item, u_split_rate }));
        getCntDetialByPhid();
        grid.clearRows().then(() => grid.addRows(data));
      }, "p_form_equipment_list_split.u_split_rate");
  
      //切分公司选择带出财务信息
      useValuesChange(({ args }) => {
        console.log("监听 切分公司", args[0]);
        const u_split_org = args[0].u_split_org.value;
        if (u_split_org) {
          costcenter();
          caculatedgrid();
        }
      }, "p_form_equipment_list_split.u_split_org");
  
      useValuesChange(({ args }) => {
        var ori = $NG.getCmpApi("p_form_equipment_list_split").getItem("u_ywfw").getOrigin();
        console.log(ori);
        $NG.updateState((updater) => {
          updater.data.p_form_equipment_list_split.setProps({
            u_ywfw_no: ori.u_ywcj_no,
          });
        });
      }, "p_form_equipment_list_split.u_ywfw");
  
      // 实施费归属
      useValuesChange(({ args }) => {
        // 先清空之前的值
        form.getItem("u_cnt_impl_now").setValue(null);
        form.getItem("u_split_impl").setValue(null);
  
        const amt = window.getEqInfoByPhid_pc?.u_implement_amt ?? 0;
        const org = args[0]?.u_impl_org?.value;
  
        if (org === "1") {
          form.getItem("u_cnt_impl_now").setValue(amt);
        }
        if (org === "2") {
          form.getItem("u_split_impl").setValue(amt);
        }
        setTimeout(() => {
          mstformcaculate();
        }, 100);
      }, "p_form_equipment_list_split.u_impl_org");
  
      // 服务费归属
      useValuesChange(({ args }) => {
        // 先清空之前的值
        form.getItem("u_cnt_svc_now").setValue(null);
        form.getItem("u_split_svc").setValue(null);
  
        const amt = window.getEqInfoByPhid_pc?.u_svc_cost_amt ?? 0;
        const org = args[0]?.u_svc_org?.value;
  
        if (org === "1") {
          form.getItem("u_cnt_svc_now").setValue(amt);
        }
        if (org === "2") {
          form.getItem("u_split_svc").setValue(amt);
        }
        setTimeout(() => {
          mstformcaculate();
        }, 100);
      }, "p_form_equipment_list_split.u_svc_org");
  
      // 二开费归属
      useValuesChange(({ args }) => {
        // 先清空之前的值
        form.getItem("u_cnt_dev_now").setValue(null);
        form.getItem("u_split_dev").setValue(null);
  
        const amt = window.getEqInfoByPhid_pc?.u_sec_dev_amt ?? 0;
        const org = args[0]?.u_dev_org?.value;
  
        if (org === "1") {
          form.getItem("u_cnt_dev_now").setValue(amt);
        }
        if (org === "2") {
          form.getItem("u_split_dev").setValue(amt);
        }
        setTimeout(() => {
          mstformcaculate();
        }, 100);
      }, "p_form_equipment_list_split.u_dev_org");
    }
  
    function getPcInfo() {
      if (form.getItem("phid_pc").getValue()) {
        $NG.execServer("getPtInfoByPhid", { phid: form.getItem("phid_pc").getValue() }, function (res) {
          const datas = JSON.parse(res.data)[0].extendObjects;
          console.log(datas);
          $NG.updateState((updater) => {
            updater.data.p_form_equipment_list_split.setProps({
              u_pc_ywlx: {
                value: datas.user_ywlx,
                label: datas.ywlx_name,
              },
              u_pc_sec_dept: {
                value: datas.org_phid,
                label: datas.org_name,
              },
            });
          });
        });
      }
    }
  
    // 主表字段属性设置
    function mstformUpdateUI(params) {
      console.log("mstformUpdateUI");
    }
  
    // 表头部分逻辑计算
    function mstformcaculate(params) {
      console.log("mstformcaculate");
      const mstform = $NG.getCmpApi("p_form_equipment_list_split");
  
      // 获取表单项
      const fields = ["u_signed_gm_rate_now", "u_cnt_amt", "u_cnt_cost", "u_grossprofit", "u_split_amt", "u_split_eq", "u_split_impl", "u_split_svc", "u_split_dev", "u_split_cost", "u_grossprofit_split", "u_cnt_amt_now", "u_cnt_impl_now", "u_cnt_svc_now", "u_cnt_dev_now", "u_cnt_cost_now", "u_grossprofit_now", "u_split_cos", "u_svc_amt_rate_split"];
  
      let formValues = {};
      fields.forEach((key) => {
        if (mstform.getItem(key)) {
          formValues[key] = Number(mstform.getItem(key).getValue()) || 0;
        }
      });
  
      // 切分公司
      formValues.u_split_cost = formValues.u_split_eq + formValues.u_split_impl + formValues.u_split_svc + formValues.u_split_dev;
      formValues.u_grossprofit_split = formValues.u_split_amt - formValues.u_split_cost;
      formValues.u_signed_gm_rate_split = formValues.u_split_cost == 0 ? 0 : formValues.u_grossprofit_split / formValues.u_split_cost;
      formValues.u_svc_amt_rate_split = formValues.u_split_cost == 0 ? 0 : formValues.u_split_svc / formValues.u_split_cost;
  
      // 切分后主体
      formValues.u_cnt_amt_now = formValues.u_cnt_amt;
      formValues.u_cnt_cost_now = formValues.u_split_amt + (formValues.u_cnt_cost - formValues.u_split_cost);
      formValues.u_grossprofit_now = formValues.u_cnt_amt_now - formValues.u_cnt_cost_now;
      formValues.u_signed_gm_rate_now = formValues.u_cnt_cost_now == 0 ? 0 : formValues.u_grossprofit_now / formValues.u_cnt_cost_now;
      formValues.u_svc_amt_rate_now = formValues.u_cnt_cost_now == 0 ? 0 : formValues.u_cnt_svc_now / formValues.u_cnt_cost_now;
      // formValues.u_cnt_eq_now = formValues.u_cnt_eq - formValues.u_split_eq;
  
      // 更新所有字段
      fields.forEach((key) => {
        if (mstform.getItem(key)) {
          mstform.getItem(key).setValue(formValues[key]);
        }
      });
  
      mstform.getItem("u_contrast").setValue(`切分前主体未税合同额：${parseFloat(formValues.u_cnt_amt).toFixed(2)}；切分前主体未税总成本：${parseFloat(formValues.u_cnt_cost).toFixed(2)}；切分前主体毛利：${parseFloat(formValues.u_grossprofit).toFixed(2)}
      切分后主体未税合同额：${parseFloat(formValues.u_cnt_amt_now).toFixed(2)}；切分后主体未税总成本：${parseFloat(formValues.u_cnt_cost_now).toFixed(2)}；切分后主体毛利：${parseFloat(formValues.u_grossprofit_now).toFixed(2)}
      切分后切分公司未税合同额：${parseFloat(formValues.u_split_amt).toFixed(2)}；切分后切分公司未税总成本：${parseFloat(formValues.u_split_cost).toFixed(2)}；切分后切分公司毛利：${parseFloat(formValues.u_grossprofit_split).toFixed(2)}
  `);
    }
  
    // 获取合同数量
    function getCntCount() {
      if (!form.getItem("phid_pc").getValue()) return;
      $NG.execServer("getCntCount", { type: 1, phid_pc: form.getItem("phid_pc").getValue() }, (res) => {
        // console.log(`合同数量`, res.count);
        window._lsz_catch_cntCount = res.count;
      });
    }
  
    // 获取设备清单信息
    function getEqInfoByPhid_pc() {
      const phid_pc = form.getItem("phid_pc").getValue();
      const phidV = 0;
      if (form.getItem("phid")) {
        phidV = form.getItem("phid").getValue();
      }
      if (!phid_pc) return;
      window.getEqInfoByPhid_pc = [];
      $NG.execServer("getEqInfoByPhid_pc", { phid_pc: phid_pc }, function (res) {
        if (res && res.count > 0) {
          // console.log("getEqInfoByPhid_pc:", res);
          var data = JSON.parse(res.data)[0].extendObjects;
          console.log("getEqInfoByPhid_pc:", data);
          window.getEqInfoByPhid_pc = data;
          // console.log(window.getEqInfoByPhid_pc);
          form.getItem("u_cnt_amt_vat")?.setValue(data.cnt_sum_vat_fc);
          form.getItem("u_cnt_amt")?.setValue(data.cnt_sum_fc);
          form.getItem("u_cnt_amt_now").setValue(data.cnt_sum_fc);
          form.getItem("u_cnt_cost")?.setValue(data.u_total_cost_amt);
          form.getItem("u_grossprofit")?.setValue(data.cnt_sum_fc - data.u_total_cost_amt);
          form.getItem("u_cnt_impl")?.setValue(data.u_implement_amt);
          form.getItem("u_cnt_svc")?.setValue(data.u_svc_cost_amt);
          form.getItem("u_cnt_dev")?.setValue(data.u_sec_dev_amt);
          form.getItem("u_signed_gm_rate").setValue(data.u_signed_gm_rate);
          form.getItem("u_svc_amt_rate").setValue(data.u_svc_cost_ratio);
  
          $NG.execServer("getSplitCount", { phid_pc: phid_pc, phid: phidV }, (res) => {
            form.getItem("bill_name").setValue((form.getItem("phid_pc").getText() || "") + "采购合同");
            form.getItem("bill_no").setValue((window.getEqInfoByPhid_pc?.u_cnt_no || "") + "-" + String(res.count + 1).padStart(2, "0"));
          });
        } else {
          console.log("功能扩展为空或报错" + "getEqInfoByPhid_pc");
          $NG.alert("提示" + "该项目未做设备清单或设备清单未审核完成，请在设备清单审核通过后，再进行切分");
        }
      });
  
      $NG.execServer("GetYwfw", { phid_pc: phid_pc }, function (res) {
        const data = JSON.parse(res.data);
        console.log(data);
        const user_bus_range_no = data[0].extendObjects.user_bus_range_no;
        const user_ywfw = data[0].extendObjects.user_ywfw;
        const u_ywcj_name = data[0].extendObjects.u_ywcj_name;
  
        $NG.updateState((updater) => {
          updater.data.p_form_equipment_list_split.setProps({
            u_ywfw_no: user_bus_range_no,
            u_ywfw: {
              value: user_ywfw,
              label: u_ywcj_name,
            },
          });
        });
      });
    }
  
    ////////////////////////////////////////////////////////////////////////////////////////////////////p_form_equipment_split_d
  
    if (grid) {
      gridUpdateUI();
  
      useUpdateRows(({ args }) => {
        console.log(`表格新增监听`, p_form_equipment_split_d);
        caculatedgrid();
        updateGrid2FromGrid();
        grid.refreshView();
      }, "p_form_equipment_split_d");
  
      setInterval(() => {
        try {
          const currentLength = grid.getData().length;
          if (currentLength !== dataMaps_key["danjv"]) {
            dataMaps_key["danjv"] = currentLength;
            grid.getData().forEach(sum);
            // console.log("可能发生了单据引用");
          }
        } catch (err) {}
      }, 500);
    }
  
    ////////////////////////////////////////////////////////////////////////////////////////////////////p_form_equipment_split_dd
    if (grid2) {
      grid2UpdateUI();
  
      useUpdateRows(() => {
        caculatedgrid();
      }, "p_form_equipment_split_dd");
    }
  
    ////////////////////////////////////////////////////////////////////////////////////////////////////function
  
    /** 监听 grid 数据变化，并同步更新 grid2 */
    function updateGrid2FromGrid() {
      let gridRows = grid.getData();
      let revenueTypeMap = new Map(gridRows.map((item) => [item.u_revenue_type, item.u_revenue_type_EXName]));
      // console.log(`查看明细`, revenueTypeMap);
      let grid2Rows = grid2.getData();
      let grid2Types = new Set(grid2Rows.map((item) => item.u_revenue_type));
      // console.log(`查看去重类型明细`, grid2Types);
      const _arr = [];
      // **新增行**
      revenueTypeMap.forEach((name, type) => {
        if (!grid2Types.has(type) && type) {
          _arr.push({ u_revenue_type: type, u_revenue_type_EXName: name });
          // console.log(`已添加 ${type}（${name}）到 grid2`);
        }
      });
      //改变地址避免影响
      grid2.addRows([..._arr]);
  
      // **删除行**
      grid2Rows.forEach((item) => {
        if (!revenueTypeMap.has(item.u_revenue_type)) {
          grid2.deleteRow(item);
          // console.log(`已删除 ${item.u_revenue_type}（${item.u_revenue_type_EXName}）`);
        }
      });
      grid2.refreshView();
    }
    setInterval(() => {
      // console.log(grid2.getData());
    }, 2000);
  
    /** 查询切分比例 */
    function selectClass(phid, callback) {
      const result = grid2.getData().find((item) => item.u_revenue_type == phid) || {};
      // console.log("查询切分成功", result);
      callback(result);
    }
  
    function getSupplyFromCnt() {
      const phidPc = form.getItem("phid_pc").getValue();
      if (!phidPc) return;
      $NG.execServer("getSupplyFromCnt", { phid_pc: phidPc }, (res) => {
        // console.log(res);
        const _arr = [];
        if (res.count == 0) return;
        const _data = JSON.parse(res.data);
        // console.log(_data);
        _data.forEach((items) => {
          const item = items.extendObjects;
          _arr.push(item.supply_id);
        });
        let str = _arr.reduce((value, item, index) => {
          if (index == 0) {
            return `${value}'${item}'`;
          }
          return `${value},'${item}'`;
        }, "(");
        str += ")";
        console.log(str, `fe.phid in ${str}`);
        $NG.updateUI((updater) => {
          // console.log(updater);
          // $NG.getPageUI(); 根据组件目录设置路径，可能存在 PCFieldSetPanelGroup[i][field]
          updater.fieldSetForm.p_form_equipment_list_split.u_split_performer.setProps({
            // hidden: false, //隐藏
            // required: true, //必输
            // disabled: true, //只读
            clientSqlFilter: `fe.phid in ${str}`, //过滤条件
            // placeholder: "请选择", //输入框字段加提示语
          });
        });
      });
    }
    // setInterval(() => {
    //   try {
    //     const currentLength = grid.getData().length;
    //     if (currentLength !== dataMaps_key["danjv"]) {
    //       dataMaps_key["danjv"] = currentLength;
    //       grid.getData().forEach(sum);
    //       caculatedgrid();
    //       console.log("可能发生了单据引用");
    //     }
    //   } catch (err) {}
    // }, 500);
  
    /** 计算每行数据 */
    function sum(item) {
      grid.refreshView();
    }
  
    function setCntDetial() {
      //   const grid_data = grid.getData();
      //   if (!window._lsz_catch_cntDetial) return;
      //   grid_data.forEach((item) => {
      //     window._lsz_catch_cntDetial.forEach((elem) => {
      //       if (item.u_cnt_d_no == elem.item_no && item._init) {
      //         item.u_qty = elem.qty;
      //         item.u_tax_rate = elem.taxrate;
      //         item.u_ori_prc_vat = elem.prc_vat_fc;
      //         item.u_ori_prc = elem.prc_fc;
      //         item.u_ori_amt_vat = elem.amt_vat_fc;
      //         item.u_ori_amt = elem.amt_fc;
      //         item._init = true;
      //       }
      //     });
      //   });
      //   grid.refreshView();
    }
  
    function getCntDetialByPhid() {
      const phidPc = form.getItem("phid_pc").getValue();
      if (!phidPc) return;
      $NG.execServer("getCntDetialByPhid", { phid_pc: phidPc }, (res) => {
        if (res.count == 0) return;
        const _data = JSON.parse(res.data);
        // console.log(_data);
        const _temp = [];
        _data.forEach((item) => {
          const data = item.extendObjects;
          _temp.push(data);
        });
        window._lsz_catch_cntDetial = [..._temp];
      });
    }
  
    // 明细表属性设置
    function gridUpdateUI(params) {
      console.log("gridUpdateUI");
    }
  
    // 明细表属性设置
    function grid2UpdateUI(params) {
      console.log("grid2UpdateUI");
    }
  
    //表体计算逻辑
    async function caculatedgrid(params) {
      // 计算总金额
      let sum_amt_vat = 0;
      let sum_amt = 0;
      let sum_u_split_cost = 0;
      let promises = []; // 用于存储所有异步请求的 Promise
      // 遍历 grid 中的每一行
      grid.getData().forEach((item) => {
        selectClass(item.u_revenue_type, (data) => {
          if (data) {
            item.u_split_rate = data.u_split_rate || 0;
          }
        });
  
        // u_ori_cost
        if (item.u_cnt_d_id) {
          const promise = new Promise((resolve) => {
            $NG.execServer("getEqDInfoByCntDetailPhid", { phid: item.u_cnt_d_id }, (res) => {
              if (res.count > 0) {
                const data = JSON.parse(res.data)[0].extendObjects;
                // 更新 item 的各项字段
                item.u_cnt_d_no = data.u_cnt_item_no; //合同清单编码
                item.u_cnt_d_id = data.u_cnt_item;
                item.u_cnt_d_id_EXName = data.u_cnt_item_name; //合同清单名称
                item.u_cnt_d_name = data.u_cnt_item_name; //合同清单名称
                item.u_model = data.u_spec; //规格型号
                item.u_unit = data.u_msunit;
                item.u_unit_EXName = data.u_msunit_name; //计量单位名称
                item.u_tech_params = data.u_tech_params; //技术参数
                item.u_pc_subitem_category = data.u_pc_subitem_category; //工程分项分类
                item.u_cnt_d_qty = data.u_qty; //合同清单数量
                item.u_qty = data.u_qty; //切分数量
                item.u_tax_rate = data.u_cnt_item_tax_rate; //税率
                item.u_ori_prc_vat = data.u_cnt_prc_vat; //含税单价
                item.u_ori_prc = data.u_cnt_prc; //未税单价
                item.u_ori_amt_vat = data.u_cnt_amt_vat; //含税金额
                item.u_ori_amt = data.u_cnt_amt; //未税金额
                item.u_split_prc_vat = data.u_cnt_prc_vat * item.u_split_rate;
                item.u_split_prc = item.u_split_prc_vat / (1 + data.u_cnt_item_tax_rate);
                item.u_split_amt_vat = Number(item.u_qty) * item.u_split_prc_vat;
                item.u_split_amt = Number(item.u_qty) * item.u_split_prc; //切分未税金额
                item.u_ori_tax_amt = item.u_ori_amt_vat - item.u_ori_amt; //切分前税额
                item.u_tax_amt = item.u_split_amt_vat - item.u_split_amt; //切分税额
                //切分公司为 青岛海信网络科技股份有限公司 的切分公司清单成本包括拟自主成本
                if (form.getItem("u_split_org").getValue() == "8570000000000018") {
                  item.u_split_cost = Number(data.u_pur_cost) + Number(data.u_sub_cost); //切分后未税成本
                } else {
                  item.u_split_cost = Number(data.u_pur_cost); //切分后未税成本
                }
                // 累加金额
                sum_amt_vat += Number(item.u_split_amt_vat) || 0;
                sum_amt += Number(item.u_split_amt) || 0;
                sum_u_split_cost += Number(item.u_split_cost) || 0;
              } else {
                console.log(item.u_cnt_d_id + "没有找到合同清单");
              }
              resolve(); // 请求完成后，调用 resolve
            });
          });
          promises.push(promise); // 将该请求的 Promise 加入 promises 数组
        }
      });
  
      // 等待所有异步请求完成
      await Promise.all(promises);
  
      // 初始化汇总对象
      const summary = grid.getData().reduce((acc, item) => {
        const revenueType = item.u_revenue_type;
        // 如果没有此收入类型，则初始化
        if (!acc[revenueType]) {
          acc[revenueType] = { u_ori_amt_vat: 0, u_split_amt_vat: 0, u_ori_amt: 0, u_split_amt: 0, u_ori_tax_amt: 0, u_tax_amt: 0, u_ori_cost: 0, u_split_cost: 0 };
        }
        // 累加每个字段的值
        acc[revenueType].u_ori_amt_vat += Number(item.u_ori_amt_vat) || 0;
        acc[revenueType].u_split_amt_vat += Number(item.u_split_amt_vat) || 0;
        acc[revenueType].u_ori_amt += Number(item.u_ori_amt) || 0;
        acc[revenueType].u_split_amt += Number(item.u_split_amt) || 0;
        acc[revenueType].u_ori_tax_amt += Number(item.u_ori_tax_amt) || 0;
        acc[revenueType].u_tax_amt += Number(item.u_tax_amt) || 0;
        acc[revenueType].u_split_cost += Number(item.u_split_cost) || 0;
        return acc;
      }, {});
  
      // 更新 grid2 数据
      grid2.getData().forEach((item) => {
        const data = summary[item.u_revenue_type] || { u_split_amt_vat: 0, u_split_amt: 0, u_tax_amt: 0 };
        Object.assign(item, data); // 批量更新数据
      });
  
      // 更新表单中的金额
      form.getItem("u_split_amt_vat")?.setValue(sum_amt_vat);
      form.getItem("u_split_amt")?.setValue(sum_amt);
      form.getItem("u_split_eq")?.setValue(sum_u_split_cost);
      setTimeout(() => {
        mstformcaculate();
      }, 100);
  
      // 刷新 grid 和 grid2
      grid.refreshView();
      grid2.refreshView();
    }
  
    function costcenter() {
      console.log("项目类型", form.getItem("u_pc_ywlx").getValue());
      console.log("二级部门", form.getItem("u_pc_sec_dept").getValue());
  
      if (form.getItem("u_pc_ywlx").getValue() == "8570000000000355") {
        $NG.execServer("GetQfZZInfo_fw", { zz: form.getItem("u_split_org").getValue(), syb: form.getItem("u_pc_sec_dept").getValue() }, function (res) {
          if (res.count == 0) return;
          const data = JSON.parse(res.data);
          console.log(data);
          const u_cbzx_no = data[0].extendObjects.u_cbzx_no;
          const u_cbzx_name = data[0].extendObjects.u_cbzx_name;
          const u_lrzx_no = data[0].extendObjects.u_lrzx_no;
          const u_lrzx_name = data[0].extendObjects.u_lrzx_name;
          const u_yszz_no = data[0].extendObjects.u_yszz_no;
          const u_yszz_name = data[0].extendObjects.u_yszz_name;
  
          $NG.updateState((updater) => {
            updater.data.p_form_equipment_list_split.setProps({
              u_cbzx_no: u_cbzx_no,
              u_cbzx: u_cbzx_name,
              u_lrzx_no: u_lrzx_no,
              u_lrzx: u_lrzx_name,
              u_yszz_no: u_yszz_no,
              u_yszz: u_yszz_name,
            });
          });
        });
      } else {
        $NG.execServer("GetQfZZInfo_ss", { zz: form.getItem("u_split_org").getValue(), syb: form.getItem("u_pc_sec_dept").getValue() }, function (res) {
          if (res.count == 0) return;
          const data = JSON.parse(res.data);
          console.log(data);
          const u_cbzx_no = data[0].extendObjects.u_cbzx_no;
          const u_cbzx_name = data[0].extendObjects.u_cbzx_name;
          const u_lrzx_no = data[0].extendObjects.u_lrzx_no;
          const u_lrzx_name = data[0].extendObjects.u_lrzx_name;
          const u_yszz_no = data[0].extendObjects.u_yszz_no;
          const u_yszz_name = data[0].extendObjects.u_yszz_name;
  
          $NG.updateState((updater) => {
            updater.data.p_form_equipment_list_split.setProps({
              u_cbzx_no: u_cbzx_no,
              u_cbzx: u_cbzx_name,
              u_lrzx_no: u_lrzx_no,
              u_lrzx: u_lrzx_name,
              u_yszz_no: u_yszz_no,
              u_yszz: u_yszz_name,
            });
          });
        });
      }
    }
  });
  